package com.itheima.listener;

import com.itheima.domain.mongo.VideoScore;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;

/**
 * @author Morty
 * @create 2022 11 10 19:37
 */
public class VideoScoreListener {


    @Autowired
    private MongoTemplate mongoTemplate;

    @RabbitListener(queuesToDeclare = @Queue("tanhua.recommend.video"))
    public void listen(VideoScore videoScore){
        mongoTemplate.save(videoScore);
    }
}
